#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n; cin >> n;
    vector<int> arr(n);
    for (auto& e : arr) cin >> e;

    int m; cin >> m;
    arr.resize(n + m, 0);
    for (int i = n; i < n + m; i++)
        cin >> arr[i];

    sort(arr.begin(), arr.end());

    int jug = 0;
    for (auto e : arr)
    {
        if (jug)cout << ' '; jug = 1;
        cout << e;
    }

    return 0;
}